#pragma once
#include "view/BasicGdiplusHelper.h"
#include "view/BasicSkinView.h"
#include "view/BasicMemDC.h"
#include "view/BasicSkinWidgetDelegate.h"
#include "view/BasicSkinButton.h"


#pragma comment(lib,"./../debug/BasicSkin.lib")

using namespace BasicSkinView;

class CBasicSkinMainWndBkgn;
class CBasicDialog : public CBasicSkinWidgetDelegate
{
public:
	CBasicDialog(void);
	~CBasicDialog(void);
public:
	void CreateBasicDialog();
	void RegDialogWndClass();

public:
	virtual void BeginEndRenderView(CBasicSkinCanvas* pCanvas,bool bBegin);
	virtual bool BsOnMessageFilter(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* lRet,CBasicSkinEvent* pEvent);
	virtual void UpdateScreenDC(HWND hWnd,HDC hdc,int x,int y,int cx,int cy,HDC hMem,int nAlpha,bool bLayer);
	virtual void BsOnInitClientViewBeginCreateWnd(CBasicSkinRootView* pRootView);
	virtual void BsOnInitClientViewAfterCreateWnd(CBasicSkinRootView* pRootView);

public:
	void OnClickClose(LPBasicSkinNotifyEvent pEvent);
			
public:
	void PrintClient(HDC hdc,RECT *rc);
	void Layout();
public:
	CBasicMemDC				m_memBkgnd;
	bool					m_bNeedRenderBkgnd;
	CBasicSkinMainWndBkgn*	m_pBkgndView;
	CBasicSkinButton*		m_pBtnClose;
};


class CBasicSkinMainWndBkgn : public CBasicSkinView
{
public:
	CBasicSkinMainWndBkgn()
		:m_pImage(NULL)
	{}
	~CBasicSkinMainWndBkgn()
	{
		if(m_pImage)
			delete m_pImage;
		m_pImage = NULL;
	}
public:
	virtual void BsOnRenderView(CBasicSkinCanvas* pCanvas)
	{
		RECT rc;
		this->BsGetClientRect(&rc);
		//pCanvas->FillRectangle(&rc,254,255,0,0);
		if(m_pImage)
		{
			pCanvas->DrawImageToRect(m_pImage,rc.left,rc.top,rc.right,rc.bottom);
		}
	}
public:
	void SetBorderImage(Image* pIm)
	{
		m_pImage = pIm;
	}
private:
	Image*			m_pImage;

};
